Thunderdome
Thunderdome is a gladitorial generational arena inspired by
generational-arena,
slotmap, and
slab. It provides constant time insertion,
lookup, and removal via small (8 byte) keys returned from Arena
.
Thunderdome's key type, Index
, is still 8 bytes when put inside of an
Option<T>
thanks to Rust's NonZero*
types.
Basic Examples
let mut arena = new;
let foo = arena.insert;
let bar = arena.insert;
assert_eq!;
assert_eq!;
arena = "Replaced";
assert_eq!;
let foo_value = arena.remove;
assert_eq!;
// The slot previously used by foo will be reused for baz
let baz = arena.insert;
assert_eq!;
// foo is no longer a valid key
assert_eq!;
Comparison With Similar Crates
Feature | Thunderdome | generational-arena | slotmap | slab |
---|---|---|---|---|
Generational Indices¹ | Yes | Yes | Yes | No |
size_of::<Index>() |
8 | 16 | 8 | 8 |
size_of::<Option<Index>>() |
8 | 24 | 8 | 16 |
Max Elements | 2³² | 2⁶⁴ | 2³² | 2⁶⁴ |
Non-Copy Values |
Yes | Yes | Yes | Yes |
no_std Support |
No | Yes | Yes | No |
Serde Support | No | Yes | Yes | No |
- Sizes calculated on rustc
1.44.0-x86_64-pc-windows-msvc
- See the Thunderdome comparison Cargo.toml for versions of each library tested.
- Generational indices help solve the ABA Problem, which can cause dangling keys to mistakenly access newly-inserted data.
Minimum Supported Rust Version (MSRV)
Thunderdome supports Rust 1.34.1 and newer. Until Thunderdome reaches 1.0, changes to the MSRV will require major version bumps. After 1.0, MSRV changes will only require minor version bumps, but will need significant justification.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.